package com.office.util;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;


@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@ApiModel("分页后的实体类")
public class PageModel<T> implements Serializable {
    @ApiModelProperty("当前页数")
    private int pageNum;  // 当前页数
    @ApiModelProperty("每页显示条数")
    private int pageSize; // 每页显示条数
    private int totalPage; // 总页数
    private Long totalRows;//总数量
    private boolean isFirstPage;//是否是第一页
    private boolean isLastPage;//是否是最后一页
    private List<T> data;
    private int[] navigatepageNums;//动态分页
    private int navigateFirstPage;//第一页
    private int navigateLastPage;//最后一页
    private boolean navigatepageLength;

    public void setNavigatepageLength() {
        if (totalPage==0||navigatepageNums.length==0){
            this.navigatepageLength =false;
        }else {
            this.navigatepageLength = totalPage - navigatepageNums[navigatepageNums.length - 1] > 2;
        }
    }




}
